<!--
 * @Author: 姚沈阳 11500793+yao-shenyang@user.noreply.gitee.com
 * @Date: 2023-10-13 10:48:37
 * @LastEditors: 姚沈阳 11500793+yao-shenyang@user.noreply.gitee.com
 * @LastEditTime: 2023-10-31 19:36:31
 * @FilePath: \实训二PC\vue-project\src\views\home\index.vue
 * @Description: 
 * qq1908552310
-->
<template>
    <div class="home_contianer">
        <a-layout style="min-height: 100vh">
            <a-layout-sider style="background: #fff;" collapsible width="200" :trigger="null">
                <div class="logo"><img style="width: 70%;height:70%;margin-left:20px;margin-top:20px;margin-right:20px"
                        src="../../assets//Icons//png/票务LOGO.png" alt="">
                </div>
                <a-menu theme="dark" mode="inline" style="background-color: #fff;color:#2B3445">
                    <template v-for="(items) in router.options.routes">
                        <a-menu-item v-if="items.children" v-for="(item) in items.children" :key="item.name">
                            <HomeOutlined v-if="item.name == '首页'" />
                            <CarOutlined v-if="item.name == '车次管理'" />
                            <LoginOutlined v-if="item.name == '车站管理'" />
                            <ControlOutlined v-if="item.name == '线路管理'" />
                            <IdcardOutlined v-if="item.name == '车票管理'" />
                            <SolutionOutlined v-if="item.name == '订单管理'" />
                            <NodeIndexOutlined v-if="item.name == '个人轨迹监控'" />
                            <router-link :to="item.path">{{ item.name }}</router-link>
                        </a-menu-item>
                    </template>

                </a-menu>
            </a-layout-sider>
            <a-layout>
                <a-layout-header style="background: #fff; padding: 0" class="header_menu">
                    <div class="bread">
                        <a-breadcrumb style="margin: 10px auto;">
                            <template v-for="(item) in route.matched">
                                <a-breadcrumb-item>{{ item.name }}</a-breadcrumb-item>
                            </template>
                        </a-breadcrumb>
                    </div>
                    <div class="usermessage">
                        <span>当前登录 zs </span>
                        <img src="../../assets/Icons/png/Image/User.png" alt="">
                    </div>

                </a-layout-header>
                <a-layout-content style="margin: 0 16px;">
                    <a-breadcrumb style="margin: 16px 0" v-if="route.name == '车票管理'">
                        123123123123
                    </a-breadcrumb>
                    <div :style="{ background: '#f5f5f5', minHeight: '360px', marginTop: '13px' }">
                        <!-- 路由视图 -->
                        <router-view></router-view>
                    </div>
                </a-layout-content>
            </a-layout>
        </a-layout>
    </div>
</template>

<script setup lang="ts">
import {
    HomeOutlined,
    CarOutlined,
    ControlOutlined,
    LoginOutlined,
    NodeIndexOutlined,
    IdcardOutlined,
    SolutionOutlined
} from '@ant-design/icons-vue';
import { defineComponent, ref, onMounted, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';

const route = useRoute()
const router: any = useRouter()

// watch(route, (newCount, oldCount) => {
//     console.log(newCount, "newwwwwwwwwwww")
//     console.log(oldCount, "oldwwwwww")
// }, { deep: true })

onMounted(() => {
    console.log(route, "route");
    console.log(router, "router")
})
</script>

<style scoped  lang="scss">
.home_contianer {
    width: 100%;
    height: 100%;
    background-color: #fff;
}

:where(.css-dev-only-do-not-override-185kyl0).ant-layout .ant-layout-sider {
    position: relative;
    min-width: 0;
    background: #fff;
    transition: all 0.2s, background 0s;
}

.header_menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.usermessage {
    margin-right: 20px;
    width: 140px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    img {
        width: 40px;
        height: 40px;
    }
}

.bread {
    width: 200px;
    height: 40px;
    line-height: 64px;
    margin-left: 20px;
    margin-top: 10px;
}
</style>